# This program is a proof of concept script to show
# you what type of information you've been disclosing
# via your web searches.  It is designed to extract
# the cached values in your Firefox form cache.  
#
# *nix usage:  cat formhistory.dat | perl firefox_forms.pl
# windows usage:  type formhistory.dat | perl firefox_forms.pl
#
# formhistory.dat is the Firefox form data cache.  You should
# make a copy of it before you attempt the above.
#
# Directions for finding formhistory.dat on your platform are here...
# http://kb.mozillazine.org/Profile_folder#Firefox
#
# I am releasing this program under the GNU Public License.
# see http://www.gnu.org/copyleft/gpl.html 
#
# The Firefox form cache is in the Mork file format
# see http://en.wikipedia.org/wiki/Mork_(file_format)
#
# Greg Conti
# http://www.rumint.org/gregconti/index.html
# May 2006



#! /usr/bin/perl

$lines=0; #used to count the number of cached form field values

@file = <STDIN>;  #load the entire file into an array

foreach $line (@file) {
  $_ = $line;
  s/\$00//g;  #remove $00's from file
  s/\\\n//g;  #remove newline from mulit-lines lines
  s/\)/\)\n/g; #add a newline after each entry   
  
  if (/\=.*\)/){ #match each entry 	
    $_ = $&; #store matching value
    s/\=//g; #remove leading = 
    s/\)//g; #remove trailing )
    print "$_\n";           
    $lines++;
  }
}
print "Number of cached values = ".$lines;
  
  
